﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DBControl;

namespace ProjectX
{
    public partial class userBuysuccess : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["userNick"] != null)
                {
                    this.username.Text = Session["userNick"].ToString();
                    this.loginlink.Visible = false;
                    this.reglink.Visible = false;
                    this.logout.Visible = true;
                    string getuserpoint = "SELECT userpoint FROM UserPoint WHERE userName = '" + Session["userNick"] + "'";
                    SqlDbHelper sdh = new SqlDbHelper();
                    string userpoint = sdh.ExecuteScalar(getuserpoint).ToString();
                    this.getusermsg.Text = "您的购买需求已发布成功，您的当前积分为：" + userpoint + "分";
                }
                else
                {
                    Response.Redirect("/");
                }
            }
        }

        protected void logout_Click(object sender, EventArgs e)
        {
            Session.Clear();
            Response.Write("<script language='javascript'>window.parent.location.href='/'</script>");
        }
    }
}